package com.carcloud.gateway.api

object DeviceApiV1Grpc {
  val METHOD_SEND_COMMAND: _root_.io.grpc.MethodDescriptor[com.carcloud.gateway.bean.api.CommandInfo, com.carcloud.gateway.bean.api.CommandResult] =
    _root_.io.grpc.MethodDescriptor.create(
      _root_.io.grpc.MethodDescriptor.MethodType.UNARY,
      _root_.io.grpc.MethodDescriptor.generateFullMethodName("CarCloud.Gateway.DeviceApiV1", "sendCommand"),
      new com.trueaccord.scalapb.grpc.Marshaller(com.carcloud.gateway.bean.api.CommandInfo),
      new com.trueaccord.scalapb.grpc.Marshaller(com.carcloud.gateway.bean.api.CommandResult))
  
  trait DeviceApiV1 extends _root_.com.trueaccord.scalapb.grpc.AbstractService {
    override def serviceCompanion = DeviceApiV1
    def sendCommand(request: com.carcloud.gateway.bean.api.CommandInfo): scala.concurrent.Future[com.carcloud.gateway.bean.api.CommandResult]
  }
  
  object DeviceApiV1 extends _root_.com.trueaccord.scalapb.grpc.ServiceCompanion[DeviceApiV1] {
    implicit def serviceCompanion: _root_.com.trueaccord.scalapb.grpc.ServiceCompanion[DeviceApiV1] = this
    def javaDescriptor: _root_.com.google.protobuf.Descriptors.ServiceDescriptor = com.carcloud.gateway.api.AccessApiV1Proto.javaDescriptor.getServices().get(1)
  }
  
  trait DeviceApiV1BlockingClient {
    def serviceCompanion = DeviceApiV1
    def sendCommand(request: com.carcloud.gateway.bean.api.CommandInfo): com.carcloud.gateway.bean.api.CommandResult
  }
  
  class DeviceApiV1BlockingStub(channel: _root_.io.grpc.Channel, options: _root_.io.grpc.CallOptions = _root_.io.grpc.CallOptions.DEFAULT) extends _root_.io.grpc.stub.AbstractStub[DeviceApiV1BlockingStub](channel, options) with DeviceApiV1BlockingClient {
    override def sendCommand(request: com.carcloud.gateway.bean.api.CommandInfo): com.carcloud.gateway.bean.api.CommandResult = {
      _root_.io.grpc.stub.ClientCalls.blockingUnaryCall(channel.newCall(METHOD_SEND_COMMAND, options), request)
    }
    
    override def build(channel: _root_.io.grpc.Channel, options: _root_.io.grpc.CallOptions): DeviceApiV1BlockingStub = new DeviceApiV1BlockingStub(channel, options)
  }
  
  class DeviceApiV1Stub(channel: _root_.io.grpc.Channel, options: _root_.io.grpc.CallOptions = _root_.io.grpc.CallOptions.DEFAULT) extends _root_.io.grpc.stub.AbstractStub[DeviceApiV1Stub](channel, options) with DeviceApiV1 {
    override def sendCommand(request: com.carcloud.gateway.bean.api.CommandInfo): scala.concurrent.Future[com.carcloud.gateway.bean.api.CommandResult] = {
      com.trueaccord.scalapb.grpc.Grpc.guavaFuture2ScalaFuture(_root_.io.grpc.stub.ClientCalls.futureUnaryCall(channel.newCall(METHOD_SEND_COMMAND, options), request))
    }
    
    override def build(channel: _root_.io.grpc.Channel, options: _root_.io.grpc.CallOptions): DeviceApiV1Stub = new DeviceApiV1Stub(channel, options)
  }
  
  def bindService(serviceImpl: DeviceApiV1, executionContext: scala.concurrent.ExecutionContext): _root_.io.grpc.ServerServiceDefinition =
    _root_.io.grpc.ServerServiceDefinition.builder("CarCloud.Gateway.DeviceApiV1")
    .addMethod(
      METHOD_SEND_COMMAND,
      _root_.io.grpc.stub.ServerCalls.asyncUnaryCall(new _root_.io.grpc.stub.ServerCalls.UnaryMethod[com.carcloud.gateway.bean.api.CommandInfo, com.carcloud.gateway.bean.api.CommandResult] {
        override def invoke(request: com.carcloud.gateway.bean.api.CommandInfo, observer: _root_.io.grpc.stub.StreamObserver[com.carcloud.gateway.bean.api.CommandResult]): Unit =
          serviceImpl.sendCommand(request).onComplete(com.trueaccord.scalapb.grpc.Grpc.completeObserver(observer))(
            executionContext)
      }))
    .build()
  
  def blockingStub(channel: _root_.io.grpc.Channel): DeviceApiV1BlockingStub = new DeviceApiV1BlockingStub(channel)
  
  def stub(channel: _root_.io.grpc.Channel): DeviceApiV1Stub = new DeviceApiV1Stub(channel)
  
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.ServiceDescriptor = com.carcloud.gateway.api.AccessApiV1Proto.javaDescriptor.getServices().get(1)
  
}